#ifndef GB28181_INTERFACE_H
#define GB28181_INTERFACE_H

#include <string>
#include <functional>
#include <memory>

namespace El {
namespace GB28181 {

enum class DeviceStatus {
    OFFLINE,
    REGISTERING,
    REGISTERED,
    HEARTBEAT_TIMEOUT,
    ERROR
};

class IGB28181Service {
public:
    virtual ~IGB28181Service() = default;
    
    using StatusCallback = std::function<void(int server_index, DeviceStatus status, const std::string& message)>;
    
    virtual bool Start() = 0;
    virtual void Stop() = 0;
    virtual bool IsRunning() const = 0;
    
    virtual std::string GetConfig() const = 0;
    
    virtual DeviceStatus GetDeviceStatus(int server_index = 0) const = 0;
    virtual std::string GetStatusString(DeviceStatus status) const = 0;
    
    virtual void SetStatusCallback(StatusCallback callback) = 0;
};

class IGB28181Factory {
public:
    virtual ~IGB28181Factory() = default;
    virtual std::unique_ptr<IGB28181Service> CreateService() = 0;
};

std::unique_ptr<IGB28181Factory> CreateGB28181Factory();

} // namespace GB28181
} // namespace El

#endif // GB28181_INTERFACE_H